package com.dongdongshop.service.impl;

import com.dongdongshop.data.PageBean;
import com.dongdongshop.mapper.TbSellerMapper;
import com.dongdongshop.mapper.TbStatusMapper;
import com.dongdongshop.pojo.TbSeller;
import com.dongdongshop.pojo.TbStatus;
import com.dongdongshop.service.SellerService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@DubboService
public class SellerServiceImpl implements SellerService {

    @Autowired
    private TbSellerMapper tbSellerMapper;

    @Autowired
    private TbStatusMapper tbStatusMapper;

    @Override
    public TbSeller check(String username) {
        return tbSellerMapper.check(username);
    }

    @Override
    public void toRegister(TbSeller tbSeller) {
        tbSellerMapper.insertSelective(tbSeller);
    }

    @Override
    public Boolean checkName(String sellerId) {
        TbSeller tb = tbSellerMapper.checkName(sellerId);
        if (tb != null) {
            return false;
        }else {
            return true;
        }
    }

    @Override
    public List<TbSeller> getSellerInfo(String name, String nickName) {
        return tbSellerMapper.getSellerInfo(name,nickName);
    }

    @Override
    public List<TbStatus> getList() {
        return tbStatusMapper.selectByExample(null);
    }

    @Override
    public TbSeller getOneSellerInfo(String sellerId) {
        return tbSellerMapper.getOneSellerInfo(sellerId);
    }

    @Override
    public void setStatus(String status, String sellerId) {
        tbSellerMapper.setStatus(status,sellerId);
    }
}
